home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / Scientist's Helper src / s.helper.5 / regwnd.c < prev   
C/C++ Source or Header  |  1986-02-06  |  16KB  |  623 lines

  1. #include "all.h"
  2. #include "regtabext.h"
  3.  
  4. LoadSg2() /*force load of segment*/
  5. {
  6.     ;
  7. }
  8.  
  9. IndentRect( rPtr )
  10. Rect *rPtr;
  11. {
  12.     rPtr->bottom = rPtr->bottom-16;
  13.     rPtr->right = rPtr->right-16;
  14.     rPtr->top = rPtr->top+4;
  15.     rPtr->left = rPtr->left+4;
  16. }
  17.  
  18. GetWndNumber( window )
  19. WindowPtr window;
  20. {
  21.     int i;
  22.     currentWindow = -1;
  23.     for ( i = 0; i < lastWindow; i++ ) {
  24.         if (theWindow[i] == window) {
  25.             currentWindow = i;
  26.                break;
  27.             } /* end if */
  28.         } /* end for */
  29. }
  30.  
  31. ResizePRect()
  32. {
  33.     pRect = theWindow[currentWindow]->portRect;
  34.     pRect.right = pRect.right - 15;
  35.     pRect.bottom = pRect.bottom - 15;
  36. }
  37.  
  38. FindLine(position, text)
  39. int position;
  40. TEHandle text;
  41. {
  42.     int i, j;
  43.     j = 0;
  44.     if( (*text)->nLines < 1 ) {
  45.         j = 0;
  46.         }
  47.     else if( position < (*text)->lineStarts[0] ) {
  48.         j = 0;
  49.         }
  50.     else if( position >= (*text)->lineStarts[ (*text)->nLines-1 ] ) {
  51.         j = (*text)->nLines;
  52.         }
  53.     else {
  54.         for( i=((*text)->nLines-1)-1; i>=0; i-- ) {
  55.             if( (position >= (*text)->lineStarts[i]) &&
  56.                 (position <  (*text)->lineStarts[i+1]) ) {
  57.                 j = i;
  58.                 break;
  59.                 } /*end if between linestarts*/
  60.             } /*end for*/
  61.         } /* end if in interior line */
  62.     return(j);
  63. }
  64.  
  65. IfOutScroll(text)
  66. TEHandle text;
  67. {
  68.     int pixelNum, bottomPixel, dv, amount, i;
  69.     char s[80];
  70.     pixelNum = (*text)->lineHeight * FindLine( (*text)->selEnd , text );
  71.     bottomPixel = topPixel[currentWindow] + 
  72.                  (theWindow[currentWindow]->portRect.bottom-theWindow[currentWindow]->portRect.top)-40;
  73.     if( !(   ( pixelNum >= (topPixel[currentWindow]+(*text)->lineHeight) ) &&
  74.              ( pixelNum <= (bottomPixel-(*text)->lineHeight)   )  ) ) {
  75.         dv = bottomPixel-pixelNum;
  76.         TEScroll( 0, dv, text );
  77.         topPixel[currentWindow] = topPixel[currentWindow] - dv;
  78.         } /*end if*/
  79.     if( (*text)->nLines > 0 ) {
  80.         amount = ( 32767L * (long)topPixel[currentWindow] ) /
  81.                  ( (long)(*text)->nLines * (long)(*text)->lineHeight);
  82.         }
  83.     else {
  84.             amount = 0;
  85.         }
  86.     SetCtlValue( vScroll[currentWindow],amount);
  87. }
  88.  
  89. DrawWindow()
  90. {
  91.     Rect tRect;
  92.     ClipRect(&(theWindow[currentWindow]->portRect));
  93.     DrawGrowIcon(theWindow[currentWindow]);
  94.  
  95.         DrawControls(theWindow[currentWindow]);
  96.  
  97.         if ( (currentWindow == grWindow) || (currentWindow == edWindow) ){
  98.             /* now set up a clip area which excludes the scroll bars */
  99.             tRect = theWindow[currentWindow]->portRect;
  100.             tRect.bottom = tRect.bottom - 16;
  101.             tRect.right = tRect.right - 16;
  102.             /* now compensate for any scrolling which has been done */
  103.             OffsetRect(&tRect, theOrigin[currentWindow].h, theOrigin[currentWindow].v);
  104.             ClipRect(&tRect);
  105.             /* change the origin to compensate for any scrolling */
  106.             SetOrigin(theOrigin[currentWindow].h, theOrigin[currentWindow].v);
  107.             DrawStuff( currentWindow );        
  108.             SetOrigin(0,0);
  109.             ClipRect(&(theWindow[currentWindow]->portRect)); /* reset the clip area */
  110.             } /*end if grwindow*/
  111.         else if ( (currentWindow == coWindow) || (currentWindow == prWindow ) ) {
  112.             DrawStuff( currentWindow );
  113.             }
  114. }
  115.  
  116. ScrollBits()
  117. {
  118.     Point oldOrigin;
  119.     int dh, dv, t1, t2, newTopPixel, newLeftPixel, i, j;
  120.     Rect tRect;
  121.     if (currentWindow == grWindow) {
  122.         ResizePRect();
  123.         oldOrigin = theOrigin[currentWindow];
  124.         t1 = (719 - theWindow[currentWindow]->portRect.right);
  125.         t2 = (373 - theWindow[currentWindow]->portRect.bottom);
  126.         theOrigin[currentWindow].h = ((long)t1 * (long)GetCtlValue(hScroll[currentWindow]))/32767L;
  127.         theOrigin[currentWindow].v = ((long)t2 * (long)GetCtlValue(vScroll[currentWindow]))/32767L;
  128.         dh = oldOrigin.h - theOrigin[currentWindow].h;
  129.         dv = oldOrigin.v - theOrigin[currentWindow].v;
  130.         theUpdateRgn = NewRgn();
  131.         ScrollRect( &pRect, dh, dv, theUpdateRgn);
  132.         /* have scrolled in junk... need to redraw */
  133.         SetOrigin(theOrigin[currentWindow].h, theOrigin[currentWindow].v);
  134.         OffsetRect(&(*theUpdateRgn)->rgnBBox,theOrigin[currentWindow].h, theOrigin[currentWindow].v);
  135.         ClipRect(&(*theUpdateRgn)->rgnBBox);
  136.         DrawStuff();
  137.         DisposeRgn(theUpdateRgn);
  138.         SetOrigin(0,0);
  139.         ClipRect(&(theWindow[currentWindow]->portRect));
  140.         } /*end if grWindow*/
  141.     else if (currentWindow == edWindow) {
  142.         ResizePRect();
  143.         ClipRect( &pRect );
  144.         DrawStuff();
  145.         ClipRect(&(theWindow[currentWindow]->portRect));
  146.         } /*end if edWindow*/
  147.     else if (currentWindow == coWindow) {
  148.         newTopPixel = (short) ( ( (long)(*coText)->nLines * (long)(*coText)->lineHeight
  149.                       * (long)GetCtlValue(vScroll[currentWindow])  )   /  32767L);
  150.         newLeftPixel = (short) ( ( (long)windowWidth * (long)GetCtlValue(hScroll[currentWindow]) )
  151.                   / 32767L );
  152.         dv = -newTopPixel + topPixel[coWindow];
  153.         dh = -newLeftPixel + leftPixel[coWindow];
  154.         topPixel[coWindow] = newTopPixel;
  155.         leftPixel[coWindow] = newLeftPixel;
  156.         TEScroll( dh, dv, coText );
  157.         }
  158.     else if (currentWindow == prWindow) {
  159.         newTopPixel = (short) ( ( (long)(*prText)->nLines * (long)(*prText)->lineHeight
  160.                       * (long)GetCtlValue(vScroll[currentWindow])  )   /  32767L);
  161.         newLeftPixel = (short) ( ( (long)windowWidth * (long)GetCtlValue(hScroll[currentWindow]) )
  162.                   / 32767L );
  163.  
  164.         dv = -newTopPixel + topPixel[prWindow];
  165.         dh = -newLeftPixel + leftPixel[prWindow];
  166.         topPixel[prWindow] = newTopPixel;
  167.         leftPixel[prWindow] = newLeftPixel;
  168.         TEScroll( dh, dv, prText );
  169.         }
  170.  
  171. }
  172.  
  173. pascal void ScrollUp(whichControl,theCode)
  174. ControlHandle whichControl;
  175. int theCode;
  176. {
  177.     if ( theCode == inUpButton ) {
  178.         SetCtlValue(whichControl,GetCtlValue(whichControl)-640);
  179.         ScrollBits();
  180.     }
  181. }
  182.  
  183. pascal void TScrollUp(whichControl,theCode)
  184. ControlHandle whichControl;
  185. int theCode;
  186. {
  187.     int amount;
  188.     if ( theCode == inUpButton ) {
  189.         if( whichControl==vScroll[coWindow] ) {
  190.                 if( (*coText)->nLines==0 ) return;
  191.             amount = (2L * 32767L) / (long)(*coText)->nLines; 
  192.             SetCtlValue(whichControl,GetCtlValue(whichControl)-amount);
  193.             }
  194.         else if( whichControl==vScroll[prWindow] ) {
  195.             if( (*prText)->nLines==0 ) return;
  196.             amount = (2L * 32767L) / (long)(*prText)->nLines; 
  197.             SetCtlValue(whichControl,GetCtlValue(whichControl)-amount);
  198.             }
  199.         else if( whichControl==vScroll[edWindow] ) {
  200.             SetCtlValue(whichControl,GetCtlValue(whichControl)-8);
  201.             }
  202.         else if( whichControl==hScroll[edWindow] ) {
  203.             SetCtlValue(whichControl,GetCtlValue(whichControl)-1024);
  204.             }
  205.         else {
  206.             SetCtlValue(whichControl,GetCtlValue(whichControl)-640);
  207.             }
  208.         ScrollBits();
  209.         }
  210. }
  211.  
  212.  
  213. pascal void ScrollDown(whichControl,theCode)
  214. ControlHandle whichControl;
  215. int theCode;
  216. {
  217.     int i;
  218.     long test;
  219.     if ( theCode == inDownButton ) {
  220.         test = (long)GetCtlValue(whichControl)+640L;
  221.         if( test<=32767 ) {
  222.             i = (int)test;
  223.             }
  224.         else {
  225.             i = 32767;
  226.             }
  227.         SetCtlValue(whichControl,i);
  228.         ScrollBits();
  229.     }
  230. }
  231.  
  232. pascal void TScrollDown(whichControl,theCode)
  233. ControlHandle whichControl;
  234. int theCode;
  235. {
  236.     int amount, i;
  237.     long test;
  238.     if ( theCode == inDownButton ) {
  239.         if( whichControl==vScroll[coWindow] ) {
  240.             if( (*coText)->nLines==0 ) return;
  241.             amount = (2L * 32767L) / (long)(*coText)->nLines;
  242.             test = (long)GetCtlValue(whichControl)+(long)amount;
  243.             if( test<=32767 ) {
  244.                 i = (int)test;
  245.                 }
  246.             else {
  247.                 i = 32767;
  248.                 }
  249.             SetCtlValue(whichControl,i);
  250.             }
  251.         else if( whichControl==vScroll[prWindow] ) {
  252.             if( (*prText)->nLines==0 ) return;
  253.             amount = (2L * 32767L) / (long)(*prText)->nLines; 
  254.             test = (long)GetCtlValue(whichControl)+(long)amount;
  255.             if( test<=32767 ) {
  256.                 i = (int)test;
  257.                 }
  258.             else {
  259.                 i = 32767;
  260.                 }
  261.             SetCtlValue(whichControl,i);
  262.             }
  263.         else if( whichControl==vScroll[edWindow] ) {
  264.             test = (long)GetCtlValue(whichControl)+8L;
  265.             if( test<=32767 ) {
  266.                 i = (int)test;
  267.                 }
  268.             else {
  269.                 i = 32767;
  270.                 }
  271.             SetCtlValue(whichControl,i);
  272.             }
  273.         else if( whichControl==hScroll[edWindow] ) {
  274.             test = (long)GetCtlValue(whichControl)+1024L;
  275.             if( test<=32767 ) {
  276.                 i = (int)test;
  277.                 }
  278.             else {
  279.                 i = 32767;
  280.                 }
  281.             SetCtlValue(whichControl,i);
  282.             }
  283.         else {
  284.             test = (long)GetCtlValue(whichControl)+640L;
  285.             if( test<=32767 ) {
  286.                 i = (int)test;
  287.                 }
  288.             else {
  289.                 i = 32767;
  290.                 }
  291.             SetCtlValue(whichControl,i);
  292.             }
  293.         ScrollBits();
  294.         }
  295. }
  296.  
  297.  
  298. TPageScroll(code,amount)
  299. int code, amount;
  300. {
  301.     Point myPt;
  302.     int onePage, linesPerPage, i;
  303.     long test;
  304.  
  305.     do {    
  306.         GetMouse(&myPt);
  307.         if ( TestControl(whichControl,pass(myPt)) == code ) {
  308.             if( whichControl==vScroll[coWindow] ) {
  309.                 linesPerPage = (theWindow[currentWindow]->portRect.bottom -
  310.                                 theWindow[currentWindow]->portRect.top) /
  311.                            (*coText)->lineHeight;
  312.                 if( (*coText)->nLines==0 ) return;
  313.                 onePage = ( (long)(linesPerPage-2) * 32767L ) / (long)(*coText)->nLines;
  314.                 if( amount<0 ) {
  315.                     onePage = (-onePage);
  316.                     }
  317.                 test = (long)GetCtlValue(whichControl)+(long)onePage;
  318.                 if( test<=0 ) {
  319.                     i=0;
  320.                     }
  321.                 else if( test<=32767 ) {
  322.                     i = (int)test;
  323.                     }
  324.                 else {
  325.                     i = 32767;
  326.                     }
  327.                 SetCtlValue(whichControl,i);
  328.                 }
  329.             else if( whichControl==vScroll[prWindow] ) {
  330.                 linesPerPage = (theWindow[currentWindow]->portRect.bottom -
  331.                                theWindow[currentWindow]->portRect.top) /
  332.                            (*prText)->lineHeight;
  333.                 if( (*prText)->nLines==0 ) return;
  334.                 onePage = ( (long)(linesPerPage-2) * 32767L) / (long)(*prText)->nLines ;
  335.                 if( amount<0 ) {
  336.                     onePage = (-onePage);
  337.                     }
  338.                 test = (long)GetCtlValue(whichControl)+(long)onePage;
  339.                 if( test<=0 ) {
  340.                     i=0;
  341.                     }
  342.                 else if( test<=32767 ) {
  343.                     i = (int)test;
  344.                     }
  345.                 else {
  346.                     i = 32767;
  347.                     }
  348.                 SetCtlValue(whichControl,i);
  349.                 }
  350.             else if( whichControl==vScroll[edWindow] ) {
  351.                 onePage = 80;
  352.                 if( amount<0 ) {
  353.                     onePage = (-onePage);
  354.                     }
  355.                 test = (long)GetCtlValue(whichControl)+(long)onePage;
  356.                 if( test<=0 ) {
  357.                     i=0;
  358.                     }
  359.                 else if( test<=32767 ) {
  360.                     i = (int)test;
  361.                     }
  362.                 else {
  363.                     i = 32767;
  364.                     }
  365.                 SetCtlValue(whichControl,i);
  366.                 }
  367.             else if( whichControl==hScroll[edWindow] ) {
  368.                 onePage = 4096;
  369.                 if( amount<0 ) {
  370.                     onePage = (-onePage);
  371.                     }
  372.                 test = (long)GetCtlValue(whichControl)+(long)onePage;
  373.                 if( test<=0 ) {
  374.                     i=0;
  375.                     }
  376.                 else if( test<=32767 ) {
  377.                     i = (int)test;
  378.                     }
  379.                 else {
  380.                     i = 32767;
  381.                     }
  382.                 SetCtlValue(whichControl,i);
  383.                 }
  384.  
  385.             else {
  386.                 SetCtlValue(whichControl,GetCtlValue(whichControl)+amount);
  387.                 }
  388.         ScrollBits();
  389.         }
  390.     }
  391.     while (StillDown());
  392. }
  393.  
  394. PageScroll(code,amount)
  395. int code, amount;
  396. {
  397.     Point myPt;
  398.  
  399.     do {    
  400.         GetMouse(&myPt);
  401.         if ( TestControl(whichControl,pass(myPt)) == code ) {
  402.             SetCtlValue(whichControl,GetCtlValue(whichControl)+amount);
  403.             ScrollBits();
  404.         }
  405.     }
  406.     while (StillDown());
  407. }
  408.  
  409.  
  410. DrawStuff()
  411. {
  412.     PenState pState;
  413.     Rect tRect;
  414.     int i, j, top, left, hLast, vLast;
  415.     char s[cmdWordLen];
  416.     float x;
  417.     
  418.     if (currentWindow == edWindow ) {
  419.         PenPat( black );
  420.         top = (GetCtlValue(vScroll[edWindow])/8)+1;
  421.         left =(GetCtlValue(hScroll[edWindow])/1024)+1;
  422.         hLast = (whichWindow->portRect.right-16)/100;
  423.         if(hLast>4) {
  424.             hLast=4;
  425.             }
  426.         vLast = (whichWindow->portRect.bottom-16)/15;
  427.         if(vLast>19) {
  428.             vLast=19;
  429.             }
  430.         for (i=0; i<hLast; i++) {
  431.             EraseRect( &(tabEd.name[i]) );
  432.             if( GoodCol(left+i)==0 ) {
  433.                 MoveTo( tabEd.name[i].left+1, tabEd.name[i].bottom-2 );
  434.                 DrawText( table.header.colName[left+i-1], 0,
  435.                           strlen(table.header.colName[left+i-1]) );
  436.                 }
  437.             } /*end for*/
  438.         for (i=0; i<vLast; i++) {
  439.             EraseRect( &(tabEd.row[i]) );
  440.             if( GoodRow(top+i)==0 ) {
  441.                 IToS( (top+i), s );
  442.                 MoveTo( tabEd.row[i].left+1, tabEd.row[i].bottom-2 );
  443.                 DrawText( s, 0, strlen(s) );
  444.                 }
  445.             } /*end for*/
  446.         for (i=0; i<vLast; i++) {
  447.         for (j=0; j<hLast; j++ ) {
  448.             EraseRect( &(tabEd.entry[i][j]) );
  449.             if( (GoodRow(top+i)==0) && (GoodCol(left+j)==0) ) {
  450.                 GetTable( (top+i), (left+j), &x );
  451.                 RToS( x, s );
  452.                 MoveTo( tabEd.entry[i][j].left+1, tabEd.entry[i][j].bottom-2 );
  453.                 DrawText( s, 0, strlen(s) );
  454.                 }
  455.             } } /*end fors*/
  456.             
  457.         i=tabEd.r - top;
  458.         j=tabEd.c - left;
  459.         if( tabEd.activeName) {
  460.             if( (j<0) || (j>=4) ) {
  461.                 (*edText)->destRect = wayOffScreen;
  462.                 (*edText)->viewRect = wayOffScreen;
  463.                 TESetSelect( 0L, (long)(*edText)->teLength, edText );
  464.                 TEDelete(edText);
  465.                 tabEd.activeName=FALSE;
  466.                 }
  467.             else {
  468.                 (*edText)->destRect = tabEd.name[j];
  469.                 ResizeEdBox();
  470.                 TEUpdate( &((*edText)->destRect), edText );
  471.                 }
  472.             } /*end if active name*/
  473.         else if (tabEd.activeEntry) {
  474.             if( (i<0) || (i>=19) || (j<0) || (j>=4) ) {
  475.                 (*edText)->destRect = wayOffScreen;
  476.                 (*edText)->viewRect = wayOffScreen;
  477.                 TESetSelect( 0L, (long)(*edText)->teLength, edText );
  478.                 TEDelete(edText);
  479.                 tabEd.activeEntry=FALSE;
  480.                 }
  481.             else {
  482.                 (*edText)->destRect = tabEd.entry[i][j];
  483.                 ResizeEdBox();
  484.                 TEUpdate( &((*edText)->destRect), edText );
  485.                 }
  486.             } /*end if active entry*/
  487.         }
  488.     else if (currentWindow == coWindow ) {
  489.         EraseRect( &((*coText)->viewRect) );
  490.         TEUpdate( &(theWindow[currentWindow]->portRect), coText );
  491.         }
  492.     else if (currentWindow == prWindow ) {
  493.         EraseRect( &((*prText)->viewRect) );
  494.         TEUpdate( &(theWindow[currentWindow]->portRect), prText );
  495.         }
  496.     else if (currentWindow == grWindow ) {
  497.         CopyBits( &grMap, &(theWindow[currentWindow]->portBits),
  498.                   &(grMap.bounds), &(grMap.bounds), srcCopy, 0L );
  499.         }
  500. }
  501.  
  502.  
  503. void MoveScrollBars()
  504. {
  505.     HideControl(vScroll[currentWindow]);
  506.     MoveControl(vScroll[currentWindow],theWindow[currentWindow]->portRect.right-15,
  507.                                     theWindow[currentWindow]->portRect.top-1);
  508.     SizeControl(vScroll[currentWindow],16,theWindow[currentWindow]->portRect.bottom-
  509.                                        theWindow[currentWindow]->portRect.top-13);
  510.     ShowControl(vScroll[currentWindow]);
  511.     HideControl(hScroll[currentWindow]);
  512.     MoveControl(hScroll[currentWindow],theWindow[currentWindow]->portRect.left-1,
  513.                        theWindow[currentWindow]->portRect.bottom-15);
  514.     SizeControl(hScroll[currentWindow],theWindow[currentWindow]->portRect.right-
  515.                        theWindow[currentWindow]->portRect.left-13,16);
  516.     ShowControl(hScroll[currentWindow]);
  517. }
  518.  
  519. ResizeEdBox()
  520. {
  521.     Rect tRect;
  522.     tRect = theWindow[edWindow]->portRect;
  523.     IndentRect( &tRect );
  524.     SectRect( &tRect, &((*edText)->destRect), &((*edText)->viewRect) );
  525. }
  526.  
  527. GrowWnd(whichWindow)
  528. WindowPtr whichWindow;
  529. {
  530.     long longResult;
  531.     short height, width;
  532.     Rect tRect;
  533.  
  534.     longResult = GrowWindow(whichWindow,pass(myEvent.where),&growRect);
  535.  
  536.     if ( longResult == 0 )
  537.         return();
  538.  
  539.     height = longResult >> 16;
  540.     width = longResult;
  541.     
  542.     /* add the old "scroll bar area" to the update region so it will */
  543.     /* be redrawn (for when the window is enlarged) */
  544.     tRect = whichWindow->portRect;
  545.     tRect.left = tRect.right - 16;
  546.     InvalRect(&tRect);
  547.     tRect = whichWindow->portRect;
  548.     tRect.top = tRect.bottom - 16;
  549.     InvalRect(&tRect);
  550.  
  551.     /* now draw the newly sized window */
  552.     SizeWindow(whichWindow,width,height,TRUE);
  553.     ClipRect(&(theWindow[currentWindow]->portRect));
  554.     MoveScrollBars();
  555.     DrawGrowIcon(whichWindow);
  556.     ResizePRect();
  557.  
  558.     /* add the new "scroll bar area" to the update region so it will 
  559.        be redrawn (for when the window is made smaller) */
  560.     tRect = whichWindow->portRect;
  561.     tRect.left = tRect.right - 16;
  562.     InvalRect(&tRect);
  563.     tRect = whichWindow->portRect;
  564.     tRect.top = tRect.bottom - 16;
  565.     InvalRect(&tRect);
  566.     
  567.     if( currentWindow == coWindow ) {
  568.         tRect = theWindow[currentWindow]->portRect;
  569.         IndentRect( &tRect );
  570.         InvalRect(&tRect);
  571.         (*coText)->viewRect = tRect;
  572.         }
  573.     else if( currentWindow == prWindow ) {
  574.         tRect = theWindow[currentWindow]->portRect;
  575.         IndentRect( &tRect );
  576.         InvalRect(&tRect);
  577.         (*prText)->viewRect = tRect;
  578.         }
  579.     else if( currentWindow == edWindow ) {
  580.         ResizeEdBox();
  581.         InvalRect(&(theWindow[currentWindow]->portRect));
  582.         }
  583.     else {
  584.         ScrollBits();
  585.         }
  586. }
  587.  
  588.  
  589. VMathCommand()
  590. {
  591.     float x, y, z;
  592.     char vValue[cmdWordLen];
  593.     
  594.     SToR( command.cmdWord[1], &x, TRUE );
  595.     SToR( command.cmdWord[3], &y, TRUE );
  596.     if( strcmp(command.cmdWord[2],"+")==0 ) {
  597.         z = x + y;
  598.         }
  599.     else if( strcmp(command.cmdWord[2],"-")==0 ) {
  600.         z = x - y;
  601.         }
  602.     else if( strcmp(command.cmdWord[2],"*")==0 ) {
  603.         z = x * y;
  604.         }
  605.     else if( strcmp(command.cmdWord[2],"/")==0 ) {
  606.         if( NaN(&y) ) {
  607.             z=infinity;
  608.             }
  609.         else {
  610.             z = x / y;
  611.             }
  612.         }
  613.     else {
  614.         ErrMsg( noSuchModifier );
  615.         }
  616.     RToS(z, vValue);
  617.     if( !SetVar(command.cmdWord[5],vValue) ){
  618.         ErrMsg("couldnt create variable");
  619.         }
  620. }
  621.  
  622.  
  623.